﻿namespace HZY.Framework.Repository.EntityFramework.Models.StandardV2;

/// <summary>
/// 创建和更新
/// </summary>
/// <typeparam name="TKey"></typeparam>
public class CreateAndUpdateEntityV2<TKey> : Entity<TKey>, ICreateAndUpdateEntityV2
{
    /// <summary>
    /// 创建人 id
    /// </summary>
    [TableField(TableFieldFill.CreateId)]
    public virtual string? CreateBy { get; set; }

    /// <summary>
    /// 创建时间
    /// </summary>
    [TableField(TableFieldFill.CreateTime)]
    public virtual DateTime CreateTime { get; set; } = DateTime.MinValue;

    /// <summary>
    /// 最后更新人id
    /// </summary>
    [TableField(TableFieldFill.UpdateId)]
    public virtual string? UpdateBy { get; set; }

    /// <summary>
    /// 最后更新时间
    /// </summary>
    [TableField(TableFieldFill.UpdateTime)]
    public virtual DateTime? UpdateTime { get; set; }
}

/// <summary>
/// 创建
/// </summary>
public interface ICreateAndUpdateEntityV2 : IEntity
{
    /// <summary>
    /// 创建用户
    /// </summary>
    [TableField(TableFieldFill.CreateId)]
    string? CreateBy { get; set; }

    /// <summary>
    /// 创建时间
    /// </summary>
    [TableField(TableFieldFill.CreateTime)]
    DateTime CreateTime { get; set; }

    /// <summary>
    /// 更新用户
    /// </summary>
    [TableField(TableFieldFill.UpdateId)]
    string? UpdateBy { get; set; }

    /// <summary>
    /// 更新时间
    /// </summary>
    [TableField(TableFieldFill.UpdateTime)]
    DateTime? UpdateTime { get; set; }
}